import { forwardRef, Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt';
import { MongooseModule } from '@nestjs/mongoose';
import { jwtConstants } from 'src/global-type';
import { SystemUserModule } from 'src/system-user/system-user.module';
import { SystemLogSchema } from './system-log.schema';
import { SystemLogService } from './system-log.service';
import { SystemLogController } from './system-log.controller';

@Module({
  imports: [
    MongooseModule.forFeature([
      {
        name: 'SystemLog',
        collection: 'system_logs',
        schema: SystemLogSchema,
      },
    ]),
    JwtModule.register({
      secret: jwtConstants.secret,
      signOptions: { expiresIn: '12h' },
    }),
    forwardRef(() => SystemUserModule),
  ],
  providers: [SystemLogService],
  exports: [SystemLogService],
  controllers: [SystemLogController],
})
export class SystemLogModule {}
